package com.zxt.service.impl;


import com.zxt.mapper.DeptMapper;
import com.zxt.pojo.Dept;
import com.zxt.service.DeptService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.time.LocalDateTime;
import java.util.List;

@Service
public class DeptServiceImpl implements DeptService {
@Autowired
private DeptMapper deptMapper;
    @Override
    public List<Dept> getDeptList() {
        List<Dept> deptList = deptMapper.getDeptList();

        return deptList;
    }

    @Override
    public void deleteById(Integer id) {
        deptMapper.deleteById(id);
    }

    @Override
    public void addDept(Dept dept) {
        dept.setCreateTime(LocalDateTime.now());
        dept.setUpdateTime(LocalDateTime.now());
        deptMapper.addDept(dept);
    }

    @Override
    public void updateDept(Dept dept) {

        dept.setUpdateTime(LocalDateTime.now());

        deptMapper.updateDept(dept);
    }

    @Override
    public Dept getById(Integer id) {
        return deptMapper.getById(id);
    }
}
